﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BiliBiliCSharpStudy.clazz.access {
    class HelloAccess {

        public static void Demo() {
            //Test1();
            Test2();
        }

        public static void Test1() {
            RaceCar raceCar = new RaceCar();
            //raceCar.Owner
            //raceCar.GetType
        }

        public static void Test2() {
            Car car = new Car();
            Console.WriteLine(car.Owner);
            car.ShowOwner();
        }
    }

    class Vehicle {
        public Vehicle(string owner) {
            //this.Owner = "N/A";
            this.Owner = owner;
        }
        public string Owner { get; set; }
    }
    class Car : Vehicle {
        public Car() : base("N/A") {
        }
        public Car(string owner) : base(owner) {
        }
        public void ShowOwner() {
            Console.WriteLine("this: " + this.Owner);
            Console.WriteLine("base: " + base.Owner);
        }
    }
    class RaceCar : Car { }
}
